# -*- coding: utf-8 -*-
# autor: sergio sardo
# data: 01 de outubro de 2013
# obs: teste com funcoes lambda

a = "sergio "
b = "andre "
c = "assis "
d = "sardo"
#e = a+b+c+d
name = reduce(lambda x,y : x+y , a+b+c+d)
print name
name2 = filter (lambda x: x!= 's', name)
print name2

num = [1,2,3,4,5,6,7,8,9]
sum = reduce(lambda x,y: x+y, num)
print "soma= " + str(sum)
sum2 = reduce(lambda x,y: x+y, filter(lambda x: x%2 != 0, num))
print "soma de ímpares= " + str(sum2)
sum3 = reduce(lambda x,y: x+y, filter(lambda x: x%2 != 1, num))
print "soma de pares= " + str(sum3)
